<?php require_once('../Connections/miportal.php');
mysql_query("SET NAMES 'utf8'"); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../private/login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "../private/login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_rs_candidato = "-1";
$id_convocatoria="-1";
if (isset($_SESSION['MM_id_target'])) {
  $colname_rs_candidato = $_SESSION['MM_id_target'];
}
if($_SESSION['MM_tp_programa']=="EMPLEATE"){
$q_string_view="asignaciones_dve"	;
$id_convocatoria="23";
}
if($_SESSION['MM_tp_programa']=="EXPERIMENTA"){
$q_string_view="asignaciones_dve"	;
$id_convocatoria="22";
}

//QUERY's
mysql_select_db($database_miportal, $miportal);
$query_rs_candidato = sprintf("SELECT * FROM asignaciones_dve WHERE id_cat_ies = %s AND id_cat_convocatoria=%s ORDER BY id_nom_fiscal ASC", GetSQLValueString($colname_rs_candidato, "int"),GetSQLValueString(23, "int"));
$rs_candidato = mysql_query($query_rs_candidato, $miportal) or die(mysql_error());
$row_rs_candidato = mysql_fetch_assoc($rs_candidato);
$totalRows_rs_candidato = mysql_num_rows($rs_candidato);
//Candidatos Incompletos
$query_rs_candidato_inc = "SELECT * FROM cor_candidato WHERE  tp_stat_registro<>4 AND id_convocatoria_activa=23 ";
$rs_candidato_inc = mysql_query($query_rs_candidato_inc, $miportal) or die(mysql_error());
$row_rs_candidato_inc = mysql_fetch_assoc($rs_candidato_inc);
$totalRows_rs_candidato_inc = mysql_num_rows($rs_candidato_inc);

?>
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximun-scale=1">
<title>FUNDACIÓN EDUCACIÓN SUPERIOR-EMPRESA</title>
<!--Hoja de estilo principal-->
<link href="../css/styletd2.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/menu.css"><!--Pemanggilan gambar favicon-->
<link rel="stylesheet" type="text/css" href="../css/mos-style.css">
 <!--pemanggilan file css-->
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script language="JavaScript">
	function confirmar ( mensaje ) {
					return confirm( mensaje );
				}
        </script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">


<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
	<script src="../js/jquery.tablesorter.widgets.js"></script>
<script id="js">$(function(){

	// define pager options
	var pagerOptions = {
		// target the pager markup - see the HTML block below
		container: $(".pager"),
		// output string - default is '{page}/{totalPages}'; possible variables: {page}, {totalPages}, {startRow}, {endRow} and {totalRows}
		output: '{startRow} - {endRow} / {filteredRows} ({totalRows})',
		// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
		// table row set to a height to compensate; default is false
		fixedHeight: true,
		// remove rows from the table to speed up the sort of large tables.
		// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
		removeRows: false,
		// go to page selector - select dropdown that sets the current page
		cssGoto:	 '.gotoPage'
	};


	// Initialize tablesorter
	// ***********************
	$("table")
		.tablesorter({
			theme: 'blue',
			headerTemplate : '{content} {icon}', // new in v2.7. Needed to add the bootstrap icon!
			widthFixed: true,
			widgets: ['zebra', 'filter'],
			sortList: [[0,0]] 
		})

		// initialize the pager plugin
		// ****************************
		.tablesorterPager(pagerOptions);

		// Delete a row
		// *************
		$('table').delegate('button.remove', 'click' ,function(){
			var t = $('table');
			// disabling the pager will restore all table rows
			t.trigger('disable.pager');
			// remove chosen row
			$(this).closest('tr').remove();
			// restore pager
			t.trigger('enable.pager');
		});

		

});</script>



</head>
<body>
 <header>
        <div id="background"></div><!--BackGround Menu header-->
		<div class="img_header_logo"></div>
		<span class="img_header_logo"><a href="http://fese.org.mx"><img src="../images/fese/FESE_home_logo.png"  height="90" alt="FESE" align="bottom" /></a></span>
		<div class="img_header_logo"></div>
		<?php include_once('../include/dir_dve_nav.php');?>
</header>

<center>
<div id="boxcontainer">
<div id="container">

<div class="pager">
		Hoja: <select class="gotoPage"></select>
		<img src="../addons/pager/icons/first.png" class="first" alt="First" title="First page" />
		<img src="../addons/pager/icons/prev.png" class="prev" alt="Prev" title="Previous page" />
		<span class="pagedisplay"></span> <!-- this can be any element, including an input -->
		<img src="../addons/pager/icons/next.png" class="next" alt="Next" title="Next page" />
		<img src="../addons/pager/icons/last.png" class="last" alt="Last" title= "Last page" />
		<select class="pagesize">
			<option selected="selected" value="100">100</option>
			<option value="200">200</option>
		</select>
                        
	</div>
 

   <?php
	if($totalRows_rs_candidato>0){
	 ?>
  <table class="tablesorter" style="width:95%">
  <thead class="data" style="text-align:center"> 
    <tr class="data">
      <th class="data" scope="col">NO.</th>
      <th class="data" scope="col">FOLIO</th>
      <th class="data" scope="col">CURP</th>
      <th class="data" scope="col">NOMBRE</th>
      <th class="data" scope="col">EMPRESA</th>
      <th class="data" scope="col">PROGRAMA</th>
      <th class="data" scope="col">VALIDAR</th>
   </tr>
    </thead>
    <?php
	$counter=1;
	do {
	$folio=NULL;
	$id_relacion=NULL;
	if($_SESSION['MM_tp_programa']=="MI PRIMERA EMPRESA"){
		$id_relacion=$row_rs_candidato['id_cor_ben_ies_primaria'];
	}else{
		$id_relacion=$row_rs_candidato['id_numRelacion'];
	}
	
	$folio="EMP".str_pad($row_rs_candidato['id_cor_candidato'],4,0, STR_PAD_LEFT)."13";
		 ?>
      <tr >
        <td class="data"><?php echo $counter; ?></td>
        <td class="data"><?php echo $folio; ?></td>
        <td class="data"><?php echo $row_rs_candidato['id_cve_curp']; ?></td>
        <td class="data"><?php echo $row_rs_candidato['nb_nom_nombre1']." ".$row_rs_candidato['nb_nom_nombre2']." ".$row_rs_candidato['nb_nom_apaterno']." ".$row_rs_candidato['nb_nom_amaterno']; ?></td>
        <td class="data"><?php echo $row_rs_candidato['id_nom_fiscal']; ?> </td>
        <td class="data"><?php echo $row_rs_candidato['nb_nom_nombre']; ?> </td>
        <td class="data"><?php if($row_rs_candidato['tp_status_validacion']==0){echo "<a onClick=\"return confirmar('¿Esta seguro que desea validar al candidato: ".$row_rs_candidato['nb_nom_nombre1']." ".$row_rs_candidato['nb_nom_nombre2']." ".$row_rs_candidato['nb_nom_apaterno']." ".$row_rs_candidato['nb_nom_amaterno']."?')\" href='dve_valida_candidato.php?rel=".base64_encode($row_rs_candidato['id_numRelacion'])."&redirect=EMPLEATE2"."'>VALIDAR</a>";}else{echo "Validado";}; ?> </td>
      </tr>
      
          
      
      <?php 
	  $counter++;
	  } while ($row_rs_candidato = mysql_fetch_assoc($rs_candidato));

	   ?>
  </table>
  <?php
	  }; //FIN DEL IF
	   ?>
<p>&nbsp;</p>

 
</div>
<!--Container-->
<div id="rightContainer">
    <div id="Bienvenida">
    <div id="cuadro">
    <h1>Bienvenido</h1>
    </div>
    
    <div >
    <br>
            <?php echo $_SESSION['MM_UsName'] ?><br><br>
            <?php echo $_SESSION['MM_nmb_target'] ?><br>
            <a href="<?php echo $logoutAction ?>">Salir</a>
            </div>
    </div>
    <br style="clear:both"/>
    <div id="convocatoria">
    <div id="cuadro">
    <h1>Convocatoria</h1>
    </div>
    <br>
    <?php 
    if(isset($_SESSION['MM_tp_programa'])&$_SESSION['MM_tp_programa']=="Vigentes"){
        echo "<select name=\"slConvocatoria\">
        <option selected=\"selected\">Seleccione</option>
        <option value=\"empleate\">Empleate</option>
        <option value=\"experimenta\">Experimenta</option>
        <option value=\"mpe\">Mi Primera Empresa</option>
        <option value=\"vecas_vinculacion\">Vecas Vinculación</option>
        </select>
        "	;
    }else{
    echo $_SESSION['MM_tp_programa'];}
    ?>
    
    </div>
</div><!--contenedor derecho-->


</div><!--Boxcontainer-->
 
   
</center>

  
  
</body>
</html>
<?php
mysql_free_result($rs_candidato);
?>
